package tyk.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tyk.mapper.BlogMapper;
import tyk.pojo.Blog;
import tyk.service.BlogService;

import java.util.List;

@Service
public class BlogServiceImpl implements BlogService {

    @Autowired
    private BlogMapper blogMapper;

    /*
    * 获得全部文章
    * */
    @Override
    public List<Blog> getAllBlog() {
        return blogMapper.getAllBlog();
    }


    /*
    * 根据id获得Blog
    * */
    @Override
    public Blog getBlogById(Integer id) {

        return blogMapper.getBlogById(id);
    }

    /*
    * 新增文章
    * */

    @Override
    public int addBlog(Blog blog) {
        return blogMapper.addBlog(blog);
    }


    /*
    * 修改文章
    * */
    @Override
    public int doEdit(Blog blog) {

        return blogMapper.doEdit(blog);
    }

    /*
    * 删除文章
    * */
    @Override
    public int delete(Integer id) {

        return blogMapper.delete(id);
    }
}
